package com.neulogistics.core.substation.api.application.converter;

import cn.hutool.json.JSONUtil;
import com.neulogistics.core.substation.api.application.query.SubstationPaymentQuery;
import com.neulogistics.core.substation.api.application.query.SubstationQuery;
import com.neulogistics.core.substation.infrastructure.persistence.orm.po.SubstationPO;
import com.neulogistics.core.substation.infrastructure.persistence.orm.po.SubstationPaymentPO;
import org.springframework.beans.BeanUtils;

public class SubstationPaymentQueryPOConverter {
    public static SubstationPaymentPO queryToPO(SubstationPaymentQuery substationPaymentQuery){
        if(substationPaymentQuery == null){
            return null;
        }

        SubstationPaymentPO substationPaymentPO = new SubstationPaymentPO();

        BeanUtils.copyProperties(substationPaymentQuery, substationPaymentPO);

        if(substationPaymentQuery.paymentType == -1){
            substationPaymentPO.setPaymentType(null);
        }

        return substationPaymentPO;
    }
}
